//
//  GAKKIBaseTextView.m
//  GANGAIKit
//
//  Created by fh on 2019/11/6.
//  Copyright © 2019 cashchina. All rights reserved.
//

#import "GAKKIBaseTextView.h"

@implementation GAKKIBaseTextView
- (void)dealloc {
    if (kDebugViewRelease) {
#ifdef DEBUG
        DBLog(@"\n ----------- TextView %@ 销毁了 ----------- \n",[self class]);
#endif
    }
}

+ (instancetype)initGAKKIBaseTextView {
    GAKKIBaseTextView *textView = [GAKKIBaseTextView new];
    textView.font = [UIFont systemFontOfSize:16];
    textView.textAlignment = NSTextAlignmentLeft;
    textView.textColor = [UIColor blackColor];
    return textView;
}

+ (GAKKIBaseTextView *)gakki_makeTextView:(void (^)(GAKKIBaseTextView * _Nonnull))block {
    GAKKIBaseTextView *textView = [GAKKIBaseTextView initGAKKIBaseTextView];
    if (block) {
        block(textView);
    }
    return textView;
}

- (GAKKITextViewFrame)gakki_frame {
    return ^(CGRect frame) {
        self.frame = frame;
        return self;
    };
}
- (GAKKITextViewBackgroundColor)gakki_backgroundColor {
    return ^(UIColor * __nullable backgroundColor) {
        self.backgroundColor = backgroundColor;
        return self;
    };
}
- (GAKKITextViewText)gakki_text {
    return ^(NSString * __nullable text) {
        self.text = text;
        return self;
    };
}
- (GAKKITextViewFont)gakki_font {
    return ^(UIFont * __nullable font) {
        self.font = font;
        return self;
    };
}
- (GAKKITextViewTextColor)gakki_textColor {
    return ^(UIColor * __nullable textColor) {
        self.textColor = textColor;
        return self;
    };
}
- (GAKKITextViewTextAlignment)gakki_textAlignment {
    return ^(NSTextAlignment textAlignment) {
        self.textAlignment = textAlignment;
        return self;
    };
}
- (GAKKITextViewDelegate)gakki_delegate {
    return ^(id<UITextViewDelegate> __nullable delegate) {
        self.delegate = delegate;
        return self;
    };
}
- (GAKKITextViewEditable)gakki_editable {
    return ^(BOOL editable) {
        self.editable = editable;
        return self;
    };
}
- (GAKKITextViewSelectable)gakki_selectable {
    return ^(BOOL selectable) {
        self.selectable = selectable;
        return self;
    };
}

@end
